package com.yan.file;

import java.io.File;
import java.io.IOException;

public class FileDemo3 {
    public static void main1(String[] args) {
        File file = new File("day05_code/src/com/yan/file");
        String[] list = file.list();
        for (String s : list) {
            System.out.println(s);
        }
        File[] files = file.listFiles();
        for (File ziFile : files) {
            System.out.println(ziFile);
        }
    }

    public static void main2(String[] args) throws IOException {
        File file = new File("day05_code/src/com/yan/file/a/b/c");
        boolean mkdirs = file.mkdirs();
        File file1 = new File("day05_code/src/com/yan/file/Student.txt");
        boolean newFile = file1.createNewFile();
        System.out.println("newFile = " + newFile);
        boolean b = file1.renameTo(new File("day05_code/src/com/yan/file/a/b/c/newStudent"));
        File file2 = new File("day05_code/src/com/yan/file/a/b/c/newStudent.txt");
        boolean delete = file2.delete();
        System.out.println("delete = " + delete);
    }


}
